<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计数器</title>
    <style>
        .counter {
            font-size: 2em;
            margin: 20px;
        }
        button {
            font-size: 1em;
            margin: 0 10px;
        }
    </style>
</head>
<body>
    <div class="counter">0</div>
    <button onclick="increment()">增加</button>
    <button onclick="decrement()">减少</button>

    <script>
        let count = 0;
        const counterElement = document.querySelector('.counter');

        function increment() {
            count++;
            counterElement.textContent = count;
        }

        function decrement() {
            count--;
            counterElement.textContent = count;
        }
    </script>
</body>
</html>
